<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-01-27 21:13:39
 * @LastEditTime: 2022-02-03 00:28:06
 * @LastEditors: CHINAKAIYUAN
 * @Description: 
 */

namespace App\Models;

class QueueMessage extends BaseModel
{

    public $table = "basedata_menu";
    protected $guarded = [];

    public function childrentree()
    {
        return $this->hasMany(get_class($this), 'parent_id', 'id')->orderBy("sort", 'asc');
    }
    public function children()
    {
        return $this->childrentree()->with(["children", "meta"]);
    }

    public function meta()
    {
        return $this->belongsTo(MenuMeta::class, "meta_id", "id");
    }

    public function role()
    {
        return   $this->hasManyThrough(Role::class, RoleMenu::class, "menu_id", "id", "id", "role_id");
    }
}
